<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%String skin = (String) session.getAttribute("USERSKIN_SESSION");%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">

<head>
    <meta charset="utf-8" />
    <%--<meta name="viewport" content="width=device-width, initial-scale=1.0" />--%>
    <title>山西省审计厅档案综合管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <jsp:include page="/inc/head.jsp" flush="true" />
    <jsp:include page="/inc/footer.jsp" flush="true" />
    <script src="${basePath}/js/devPublic.js"></script>
    <script src="${basePath }/js/tip.js"></script>
</head>
<style>
    * {
        margin: 0;
        padding: 0
    }

    .tablestyle tr {
        width: 100%
    }

    .tablestyle td {
        font-size: 13px;
        height: 40px;
    }

    .tablestyle .content {
        padding-left: 20px;
    }

    .tablestyle select {
        width: 130px;
    }

    .tablestyle input {
        border: 1px solid #AAAAAA;
        border-radius: 3px;
        width: 130px;
        height: 28px;
    }

    .content #rowToolBar .box-info {
        margin-bottom: 0;
        border-top: 0;
    }
    .content #rowToolBar .box-info .box-body {
        padding: 0;
    }
    .content #rowToolBar .box-info .box-body .form-group {
        margin-top: 0!important;
    }
    .content #rowToolBar .box-info .box-body .form-group:first-child {
        line-height: 34px;
    }
    .content #rowToolBar .box-info .box-body .form-group .form-group {
        margin-bottom: 0;
    }
    #tab>div:last-child {
        border-bottom:1px solid #000;
    }
</style>

<body class="hold-transition skin-blue sidebar-mini">
    <!-- Main content -->
    <section class="content">
        <!-- /rowToolBar -->
        <div id="rowToolBar" class="row" style="height: 100%;">
            <div class="col-xs-12">
                <div class="box box-info">
                    <form class="form-horizontal">
                        <!-- /.box-header -->
                        <div class="box-body">
                            <div class="form-group"
                                style="float: left ;margin-right: 30px;margin-top: 20px;margin-bottom: 5px;margin-left: 8px;">
                                <label>请输入检索信息：</label>
                            </div>
                            <div class="form-group"
                                style="float: left ;margin-right: 30px;margin-top: 15px;margin-bottom: 5px;margin-left: 8px;">
                                <div class="form-group">
                                    <input id="arcSearchMessage" class="form-control" style="width: 500px"  placeholder="请输入题名/档号/案卷号/审计组长/文号/责任者信息进行检索">
                                    <input id="hiddenText" type="text" style="display:none" >
                                </div>
                            </div>
                            <div class="form-group"
                                style="float: left ;margin-right: 30px;margin-top: 15px;margin-bottom: 5px;margin-left: 8px;">
                                <button type="button" class="btn btn-success" onclick="searchall()" id="searchButton">检索</button>
                                <shiro:hasPermission name="cms:search:accredit">
                                    <button type="button" class="btn btn-success"
                                        onclick="giveSearchInfo()">授权检索内容</button>
                                </shiro:hasPermission>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </form>
                    <!-- /.form -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col-xs-12 -->
        </div>
        <div id="tab">
        </div>
        <!-- 展示登记记录表 目的进行授权检索 -->
        <div id="showRegistDeploy" class="modal fade bs-example-modal-lg addUpdateInfo" role="dialog"
            aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog " role="document">
                <div class="modal-content" style="width: 800px;">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="showRegistDeployLabel">登记记录</h4>
                    </div>
                    <div>
                        <table id="showRegistTable">
                        </table>
                        <input type="hidden" id="fileIdHidden" value="" />
                    </div>
                    <div class="modal-footer bg-info">
                        <button type="button" class="btn green" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" id="searchFile" onclick="accreditAction(this);">
                            授权
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </section>
    <jsp:include page="/WEB-INF/jsp/searchArchive/viewfileArchive.jsp" flush="true" />
    <jsp:include page="/WEB-INF/jsp/preArchive/viewOriginal.jsp" flush="true" />
    <script>

        $(function () {
            //模拟回车键点击检索功能
            $(document).keyup(function (event) {
                if(event.keyCode==13){
                    $("#searchButton").trigger("click");
                }
            });
        })
        /**
         *    状态显示按钮
         */
        function statusFormatter(value, row, index) {
            if (value == 0) {
                return '<font style="color:dodgerblue;">正常</font>'
            }
            if (value == 1) {
                return '<font style="color:grey;">鉴定中</font>'
            }
            if (value == 2) {
                return '<font style="color:grey;">借阅中</font>'
            }
        }

        /**
         *    格式化时间(格式YYYY-dd-MM HH:mm:ss)
         */
        function timeFormatter(value, row, index) {
            return formatshortDateTime(value);
        }

        /**
         *    件操作按钮
         */
        function itemActionFormatter(value, row, index) {
            if (row.itemStatus == 0) {
                return '<shiro:hasPermission name="cms:search:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + ',1)"  >查看原文</a></shiro:hasPermission>&nbsp;&nbsp;&nbsp;' +
                    '<a style="color:#01579b;" href="javascript:void(0)"  onclick="borrowJudVol(' + row.itemId + ',1)" >借阅</a>&nbsp;&nbsp;&nbsp;' +
                    '<shiro:hasPermission name="cms:search:appraisal"><a style="color:#01579b;" href="javascript:void(0)"  onclick="appraisalAction(' + row.itemId + ',1)" >鉴定</a></shiro:hasPermission>';
            } else {
                return '<shiro:hasPermission name="cms:search:essay"><a style="color:#01579b;" href="javascript:void(0)" onclick="detailAction(' + row.itemId + ',1)" >查看原文</a></shiro:hasPermission>';
            }
        }

        function searchall() {
            $("#tab").empty();
            var arcSearchMessage = $("#arcSearchMessage").val();//单元号
            if (arcSearchMessage == "" || arcSearchMessage == null) {
                confirmEvent('请输入检索信息!');
            } else {
                $.ajax({
                    url: "${pageContext.request.contextPath }/pcwindow/searchSolrByVolOrItemOrSinItem",
                    data: { searchStr: arcSearchMessage },
                    type: "post",
                    dataType: "json",
                    async: false,
                    success: function (result) {
                        var vloNum = result.searchVolNum;
                        var itemNum = result.searchItemNum;
                        var sinItemNum = result.searchSinItemNum;
                        var totalNum = vloNum + itemNum + sinItemNum;
                        var vollist = result.vollist;
                        var itemlist = result.itemlist;
                        var sinItemlist = result.sinItemlist;
                        var bbb = '<div><label>共查询数据 ' + totalNum + ' 条  :  其中查询到卷信息 ' + vloNum + ' 条，卷内件信息 ' + itemNum + ' 条，单件信息 ' + sinItemNum + ' 条</label></div><br>';
                        var aaa = "";
                        var ccc = "";
                        $.each(vollist, function (i, volVo) {
                            var vstu = "无";
                            var buttonDiv = "";
                            var appraisalDiv = "";
                            var vsecret = "无";
                            var volClass = "无";
                            var volStorageTime = "无";
                            var volArchiveUnit = "无";
                            var volTitle = "无";
                            var volCaseNum = "无";
                            var volArchiveYear = "无";
                            if (volVo.volStatus == 0) {
                                vstu = "正常";
                                buttonDiv = '<div id ="borrowVol" style="float: left;margin-right: 10px"><button  href="javascript:;" onclick="borrowJudVol(' + volVo.volId + ',0)">借阅</button></div>'
                                appraisalDiv = '<div style="float: left;margin-right: 10px"><shiro:hasPermission name="cms:search:appraisal"><button id="zjdsr" href="javascript:;" onclick="appraisalAction(' + volVo.volId + ',0)">鉴定</button></div></shiro:hasPermission>'
                            } else if (volVo.volStatus == 1) {
                                vstu = "鉴定中";
                            } else {
                                vstu = "借阅中";
                            }

                            if (volVo.volSecret == "" || volVo.volSecret == null) {
                                vsecret = "无";
                            } else {
                                vsecret = secretLevel[volVo.volSecret];
                                if (vsecret == undefined) {
                                    vsecret = "无";
                                }
                            }
                            if (volVo.volClass != "" || volVo.volClass != null) {
                                volClass = archiveType[volVo.volClass];
                                if (volClass == undefined) {
                                    volClass = "无";
                                }
                            }
                            if (volVo.volStorageTime != "" || volVo.volStorageTime != null) {
                                volStorageTime = storageTime[volVo.volStorageTime];
                                if (volStorageTime == undefined) {
                                    volStorageTime = "无";
                                }
                            }
                            if (volVo.volArchiveUnit != "" || volVo.volArchiveUnit != null) {
                                volArchiveUnit = orgList[volVo.volArchiveUnit];
                                if (volArchiveUnit == undefined) {
                                    volArchiveUnit = "无";
                                }
                            }
                            if (volVo.volTitle != "" || volVo.volTitle != null) {
                                volTitle = volVo.volTitle;
                            }
                            if (volVo.volCaseNum != "" || volVo.volCaseNum != null) {
                                volCaseNum = volVo.volCaseNum;
                            }
                            if (volVo.volArchiveYear != "" || volVo.volArchiveYear != null) {
                                volArchiveYear = volVo.volArchiveYear;
                            }
                            bbb += '<div>' +
                                '<div style="border-top:1px solid #000;padding:0 0 5px 0;"><p style="color: blue">卷</p>' +
                                '<div style="display:inline-block;margin-right: 10px"><input type="checkbox" data-fileType="0" value="' + volVo.volId + '"/></div>' +
                                '<div style="display:inline-block;margin-right: 30px">题名：' + volTitle + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">案卷类型：' + volClass + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">保管期限：' + volStorageTime + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">档号：' + volCaseNum + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">归档年度：' + volArchiveYear + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">归档单位：' + volArchiveUnit + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">密级：' + vsecret + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">总卷数：' + volVo.volTotal + '</div>' +
                                '<div style="display:inline-block;"><p style="color: green">案卷状态：' + vstu + '</p></div><div></div>' + buttonDiv + appraisalDiv +
                                '<div><button href="javascript:;" onclick="findItemMessage(' + volVo.volId + ')">详情</button></div>' +
                                '</div></div>';
                        });
                        $.each(itemlist, function (i, itemVo) {
                            var istu = "无";
                            var buttonDivItem = "";
                            var appraisalDiv = "";
                            var isecret = "无";
                            var itemTitle = "无";
                            var itemRespons = "无";
                            var vitemName = "无";
                            var itemCreateTime = "无";
                            if (itemVo.itemStatus == 0) {
                                istu = "正常";
                                buttonDivItem = '<button style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="borrowJudVol(' + itemVo.itemId + ',1)">借阅</button>';
                                appraisalDiv = '<shiro:hasPermission name="cms:search:appraisal"><button  style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="appraisalAction(' + itemVo.itemId + ',1)">鉴定</button></shiro:hasPermission>'
                            } else if (itemVo.itemStatus == 1) {
                                istu = "鉴定中";
                            } else {
                                istu = "借阅中";
                            }
                            //是档案管理员，显示查看原文、鉴定按钮
                            buttonOrg = '<shiro:hasPermission name="cms:search:essay"><button style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="detailAction(' + itemVo.itemId + ',1)">查看原文</button></shiro:hasPermission>'
                            if (itemVo.itemSecret == "" || itemVo.itemSecret == null) {
                                isecret = "无";
                            } else {
                                isecret = secretLevel[itemVo.itemSecret];
                                if (isecret == undefined) {
                                    isecret = "无";
                                }
                            }
                            if (itemVo.itemTitle != "" && itemVo.itemTitle != null) {
                                itemTitle = itemVo.itemTitle;
                            }
                            if (itemVo.itemName != "" && itemVo.itemName != null) {
                                vitemName = itemVo.itemName;
                            }
                            if (itemVo.itemRespons != "" && itemVo.itemRespons != null) {
                                itemRespons = itemVo.itemRespons;
                            }
                            if (itemVo.itemCreateTime != "" && itemVo.itemCreateTime != null) {
                                itemCreateTime = itemVo.itemCreateTime;
                            }
                            aaa += '<div>' +
                                '<div style="border-top:1px solid #000;padding:0 0 5px 0;"><p style="color: blue">卷内件</p>' +
                                '<div style="display:inline-block;margin-right: 10px"><input type="checkbox"  data-fileType="1"  value="' + itemVo.itemId + '"/></div>' +
                                '<div style="display:inline-block;margin-right: 30px">题名：' + itemTitle + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">文号：' + vitemName + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">责任者：' + itemRespons + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">发文日期：' + itemCreateTime + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">密级：' + isecret + '</div>' +
                                '<div style="display:inline-block;"><p style="color: green">件状态：' + istu + '</p></div><div></div>' + buttonDivItem + appraisalDiv + buttonOrg +
                                '</div></div>';
                        });
                        $.each(sinItemlist, function (i, sinItemVo) {
                            var istu = "无";
                            var buttonDivItem = "";
                            var appraisalDiv = "";
                            var ssecret = "无";
                            var sitemTitle = "无";
                            var sitemRespons = "无";
                            var sitemName = "无";
                            var sitemCreateTime = "无";
                            if (sinItemVo.itemStatus == 0) {
                                istu = "正常";
                                buttonDivItem = '<button style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="borrowJudVol(' + sinItemVo.itemId + ',2)">借阅</button>';
                                appraisalDiv = '<shiro:hasPermission name="cms:search:appraisal"><button  style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="appraisalAction(' + sinItemVo.itemId + ',2)">鉴定</button></shiro:hasPermission>'
                            } else if (sinItemVo.itemStatus == 1) {
                                istu = "鉴定中";
                            } else {
                                istu = "借阅中";
                            }
                            buttonOrg = '<shiro:hasPermission name="cms:search:essay"><button style="margin-right: 10px" id="zjdsr" href="javascript:;" onclick="detailAction(' + sinItemVo.itemId + ',2)">查看原文</button></shiro:hasPermission>'
                            if (sinItemVo.itemSecret == "" || sinItemVo.itemSecret == null) {
                                ssecret = "无";
                            } else {
                                ssecret = secretLevel[sinItemVo.itemSecret];
                                if (ssecret == undefined) {
                                    ssecret = "无";
                                }
                            }
                            if (sinItemVo.itemTitle != "" && sinItemVo.itemTitle != null) {
                                sitemTitle = sinItemVo.itemTitle;
                            }
                            if (sinItemVo.itemName != "" && sinItemVo.itemName != null) {
                                sitemName = sinItemVo.itemName;
                            }
                            if (sinItemVo.itemRespons != "" && sinItemVo.itemRespons != null) {
                                sitemRespons = sinItemVo.itemRespons;
                            }
                            if (sinItemVo.itemCreateTime != "" && sinItemVo.itemCreateTime != null) {
                                sitemCreateTime = sinItemVo.itemCreateTime;
                            }
                            ccc += '<div>' +
                                '<div style="border-top:1px solid #000;padding:0 0 5px 0;"><p style="color: blue">单件</p>' +
                                '<div style="display:inline-block;margin-right: 10px"><input type="checkbox"  data-fileType="2"  value="' + sinItemVo.itemId + '"/></div>' +
                                '<div style="display:inline-block;margin-right: 30px">题名：' + sitemTitle + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">文号：' + sitemName + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">责任者：' + sitemRespons + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">发文日期：' + sitemCreateTime + '</div>' +
                                '<div style="display:inline-block;margin-right: 30px">密级：' + ssecret + '</div>' +
                                '<div style="display:inline-block;"><p style="color: green">件状态：' + istu + '</p></div><div></div>' + buttonDivItem + appraisalDiv + buttonOrg +
                                '</div></div>';
                        });
                        bbb += aaa + ccc;
                        $("#tab").append(bbb);
                    },
                    error: function () {
                        $('#systemModal').modal("show");
                    }

                })
            }
        }
        function borrowJudVol(id, type) {
            window.location.href = '${basePath}/pcwindow/toBorrowArchive?id=' + id + '&type=' + type;
        }

        function appraisalAction(id, type) {
            window.location.href = '${basePath}/pcwindow/arcAppraisal?id=' + id + '&type=' + type;
        }

        function findItemMessage(volId) {
            var opt = {
                url: '${basePath}/pcwindow/itemAndVolumeByVolId?volId=' + volId,
                silent: true,
            };
            $("#viewArchiveTable").bootstrapTable('refresh', opt);
            $('#viewArchiveModel').modal({
                keyboard: true
            });
        }

        //卷内件列表
        $("#viewArchiveTable").bootstrapTable({
            height: 440,
            striped: true,//是否显示行间隔色
            // search: false,//是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            showRefresh: false,//是否显示刷新按钮
            //showColumns: true,//是否显示所有的列
            minimumCountColumns: 2,//最少允许的列数
            clickToSelect: true,//是否启用点击选中行
            detailView: false,//是否显示父子表
            detailFormatter: 'detailFormatter',
            pagination: false,//是否显示分页（*）
            paginationLoop: false,
            sidePagination: 'server',//分页方式：client客户端分页，server服务端分页（*）
            silentSort: false,
            smartDisplay: false,
            escape: true,
            searchOnEnterKey: true,
            idField: 'itemId',
            maintainSelected: true,
            columns: [
                { field: 'ck', checkbox: true },
                { field: 'itemNum', title: '序号', align: 'center' },
                { field: 'itemPage', title: '页次', align: 'center' },
                { field: 'itemTemporary', title: '单元号', align: 'center' },
                { field: 'itemTitle', title: '题名', align: 'center' },
                { field: 'itemCreateTime', title: '发文日期', align: 'center' },
                { field: 'itemName', title: '文号', align: 'center' },
                { field: 'itemRespons', title: '责任者', align: 'center' },
                { field: 'itemSecret', title: '密级', align: 'center' },
                { field: 'itemStatus', title: '档案状态', formatter: 'statusFormatter' },
                {
                    field: 'action',
                    title: '操作',
                    align: 'center',
                    formatter: 'itemActionFormatter',
                    events: 'actionEvents',
                    clickToSelect: false
                }
            ]
        });

        /**
         * 跳转原文页面
         */
        function detailAction(id,type) {
            var url = "";
            var data ={};
            if (id != "" && id != null) {
                if(type == 1){
                    url = "${basePath}/pcwindow/item/viewItemOriginal";
                    data = {id:id};
                }else{
                    url = "${basePath}/pcwindow/sin/viewSinItemOriginal";
                    data = {itemId:id};
                }
                $.ajax({
                    type: "post",
                    url: url,
                    data: data,
                    success: function (data) {
                        if (data != "failure") {
                            $('#openPdfModel').modal({
                                keyboard: true
                            });
                            var url = data;
                            var str = url.substr(url.length - 4, url.length - 1);
                            if (str == ".jpg" || str == ".png") {
                                var htmlImg = '<img src="' + url + '" style=" width:100%;height: 100%;" alt="预览">';
                                $("#pdfDialog").eq(0).append(htmlImg);
                            } else {
                                var options = {
                                    pdfOpenParams: {
                                        pagemode: "thumbs",
                                        navpanes: '0',
                                        /*toolbar: '0',*/ //去掉工具栏,打印,下载等,,,,
                                        statusbar: '0',
                                        view: 'FitV'
                                    }
                                };
                                var myPDF = PDFObject.embed(data, "#pdfDialog", options);
                            }
                        } else {
                            confirmEvent('获取原文失败!');
                        }
                    },
                    error: function () {
                        confirmEvent('加载错误,请联系管理员!');
                    }
                })
            } else {
                confirmEvent('请选择数据!');
            }
        }

        /********************************************授权检索数据 （开始）*********************************************/
        //点击授权
        function giveSearchInfo() {
            $("#showRegistTable").bootstrapTable("destroy");
            var checkeds = $("#tab").find(":checked");
            var length = checkeds.length;
            if (length == 0) {
                confirmEvent('请选择文件!');
                return;
            }
            var fileIds = {};
            for (var index = 0; index < length; index++) {
                var fileId = checkeds.eq(index).val();
                var fileType = checkeds.eq(index).attr("data-fileType");
                fileIds[fileId] = fileType;
            }
            var fileStr = JSON.stringify(fileIds);
            $("#fileIdHidden").val(fileStr);
            showSearchRegister();
            $("#showRegistDeploy").modal("show");
        }

        //展示检索登记数据
        function showSearchRegister() {
            $("#showRegistTable").bootstrapTable({
                url: "${basePath}/pcwindow/getSearchRegiser",
                striped: true,
                search: false,
                showRefresh: true,
                showColumns: true,
                minimumCountColumns: 2,
                clickToSelect: true,
                detailView: false,
                //            detailFormatter: 'cmsBorRegisterView',
                pagination: true,
                paginationLoop: false,
                sidePagination: 'server',
                silentSort: false,
                smartDisplay: false,
                escape: true,
                searchOnEnterKey: true,
                idField: 'id',
                maintainSelected: true,
                toolbar: '#listBar',
                columns: [
                    { field: 'ck', checkbox: true },
                    { field: 'id', visible: false },
                    { field: 'registerNum', title: '登记号', sortable: true, align: 'center' },
                    { field: 'extend1', title: '检索内容', sortable: true, align: 'center' },
                    { field: 'borPurpose', title: '检索原因', sortable: true, align: 'center' },
                    {
                        field: 'borStatus',
                        title: '授权状态',
                        sortable: true,
                        align: 'center',
                        formatter: "accreditStatusFormatter"
                    },
                    { field: 'planReturnTime', title: '检索到期时间', sortable: true, align: 'center', formatter: "timeFormatter" },
                ]
            })
        }

        //授权状态初始化
        function accreditStatusFormatter(value, row, index) {
            if (value == 0) {
                return '<font style="color:#f0692f;">未授权</font>';
            } else if (value == 1) {
                return '<font style="color:darkgreen;">已授权</font>';
            } else {
                return '<font style="color:darkred;">权限已过期</font>';
            }
        }

        //点击授权操作
        function accreditAction(evn) {
            $(evn).attr("disabled", true);
            var fileIdStr = $("#fileIdHidden").val();
            var registerIds = [];
            var rows = $("#showRegistTable").bootstrapTable("getSelections");
            if (rows.length == 0) {
                confirmEvent('请选择一条申请进行授权!');
                $(evn).attr("disabled", false);
                return;
            } else {
                //查看是否选择了已经授权的记录，默认是没有选择
                var isHaveAccredit = false;
                for (var index = 0; index < rows.length; index++) {
                    var status = rows[index].borStatus;
                    if (status == 1 || status == 3) {
                        isHaveAccredit = true;
                        break;
                    }
                    registerIds.push(rows[index].id);
                }
                if (isHaveAccredit) {
                    confirmEvent('请选择未授权的申请进行授权!');
                    $(evn).attr("disabled", false);
                    return;
                } else {
                    Ewin.confirm({ message: '请确认授权的检索是否与申请的一致！' }).on(function (e) {
                        if (!e) {
                            return;
                        } else {
                            $.ajax({
                                url: "${basePath}/pcwindow/accreditSearchRegiser",
                                type: "post",
                                data: { "fileIds": fileIdStr, "registerIds": registerIds.join(",") },
                                dataType: 'json',
                                success: function (data) {
                                    var code = data.code;
                                    if (code == 1) {
                                        confirmEvent('授权成功');
                                        $(evn).attr("disabled", false);
                                        $("#showRegistDeploy").modal("hide");
                                    }
                                },
                                error: function () {
                                    confirmEvent('系统开小差了，请稍后再试!');
                                    $(evn).attr("disabled", false);
                                }
                            })
                        }
                        ;
                    });
                }
            }
        }

        /********************************************授权检索数据 （结束）*********************************************/

    </script>
</body>

</html>